package com.example.zhu.controller;

import com.example.zhu.dto.OrderCountDTO;
import com.example.zhu.result.Result;
import com.example.zhu.service.OrderCountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/order/count")
@CrossOrigin
public class OrderCountController {


    @Autowired
    private OrderCountService orderCountService;

    /**
     *  编辑取件码及其个数
     * @return
     */
    @PostMapping("/update")
    public Result orderCount(@RequestBody OrderCountDTO orderCountDTO){
        log.info("获取到的取件信息，{}:",orderCountDTO);
//        orderCountService.
        return orderCountService.update(orderCountDTO);
//        orderCountService.update();
    }

    @PutMapping("/update3/{id}")
    public Result update3(@PathVariable Integer id){
        log.info("当前取件码id,{}:",id);
        return orderCountService.update3(id);
    }

    @PutMapping("/updatef3/{id}")
    public Result updatef3(@PathVariable Integer id,@RequestBody String helperRemark){
        log.info("当前取件码id,{},帮手备注:{}:",id,helperRemark);
        return orderCountService.updatef3(id,helperRemark);
    }

    /**
     * 更新取件码的状态为2
     * @param id
     * @return
     */
    @PutMapping("/update2/{id}")
    public Result update2(@PathVariable Integer id){
        log.info("当前取件码id,{}:",id);
        return orderCountService.update2(id);
    }



}
